﻿using System;
using Newtonsoft.Json;

namespace CuteRibs.WowArmory.Models
{
	#region Guild
	/// <summary>
	/// {
	///		"name": "Apostle",
	///		"region": "亚雷戈斯",
	///		"battlegroup": "Battle Group 16",
	///		"level": 25,
	///		"members": 485,
	///		"achievementPoints": 1110,
	///		"emblem": {}
	///	}
	/// </summary>
	[JsonObject]
	public class Guild : BNObjectBase
	{
		//"name": "Apostle"
		[JsonProperty("name")]
		public string Name { get; set; }

		//"region": "亚雷戈斯"
		[JsonProperty("realm")]
		public string Realm { get; set; }

		//"battlegroup": "Battle Group 16"
		[JsonProperty("battlegroup")]
		public string Battlegroup { get; set; }

		//"level": 25
		[JsonProperty("level")]
		public int Level { get; set; }

		//"members": 485
		[JsonProperty("members")]
		public int Members { get; set; }

		//"achievementPoints": 1110
		[JsonProperty("achievementPoints")]
		public int AchievementPoints { get; set; }

		//"emblem": {}
		[JsonProperty("emblem")]
		public GuildEmblem Emblem { get; set; }
	}
	#endregion

	#region GuildDetails
	/// <summary>
	/// {
	///		"lastModified": 1348347650000,
	///		"charName": "Apostle",
	///		"region": "亚雷戈斯",
	///		"battlegroup": "Battle Group 16",
	///		"level": 25,
	///		"side": 1,
	///		"achievementPoints": 1110,
	///		"achievements": {},
	///		"members": [],
	///		"emblem": {},
	///		"news": []
	///	}
	/// </summary>
	[JsonObject]
	public class GuildDetails : Guild
	{
		[JsonProperty("lastModified")]
		[JsonConverter(typeof(BNDateTimeConverter))]
		public DateTime LastModified { get; set; }

		[JsonProperty("side")]
		public int Side { get; set; }

		[JsonProperty("achievements")]
		public CompletedAchievements Achievements { get; set; }

		[JsonProperty("members")]
		public new GuildMember[] Members { get; set; }

		[JsonProperty("news")]
		public GuildNews[] News { get; set; }
	} 
	#endregion

	#region GuildMember
	/// <summary>
	/// {
	///		"team": {},
	///		"rank": 3
	///	}
	/// </summary>
	[JsonObject]
	public class GuildMember
	{
		[JsonProperty("character")]
		public Character Character { get; set; }

		[JsonProperty("rank")]
		public int Rank { get; set; }
	} 
	#endregion

	#region GuildNews
	/// <summary>
	/// {
	///		"type": "itemLoot",
	///		"team": "断了角的牛牛",
	///		"timestamp": 1348335480000,
	///		"achievement": {},
	///		"itemId": 77238
	///	}
	/// </summary>
	[JsonObject]
	public class GuildNews
	{
		[JsonProperty("type")]
		public string Type { get; set; }

		[JsonProperty("character")]
		public string Character { get; set; }

		[JsonProperty("timestamp")]
		[JsonConverter(typeof(BNDateTimeConverter))]
		public DateTime Timestamp { get; set; }

		[JsonProperty("achievement")]
		public Achievement Achievement { get; set; }

		[JsonProperty("itemId")]
		public int ItemId { get; set; }
	} 
	#endregion
}
